package org.sage.sdk.dada.order.entity;

import lombok.Data;
import org.sage.sdk.dada.infrastructure.common.BaseEntity;
import org.sage.sdk.dada.infrastructure.common.attributes.OrderId;
import org.sage.sdk.dada.infrastructure.common.attributes.ShopNo;
import org.sage.sdk.dada.infrastructure.common.attributes.TransporterId;
import org.sage.sdk.dada.infrastructure.utils.GetBodyUtil;

import javax.validation.constraints.NotNull;

/**
 * 追加订单
 * <p>
 * 商户调用该接口将已发布的订单追加给指定的配送员,接口URL地址：/api/order/appoint/exist
 * <p>
 * 1. 追加的订单必须是该门店发出的处于待接单状态的订单
 * 2. 只能从符合条件的配送员列表选取配送员进行追加,参考查询追加配送员
 *
 * @author 周广明
 * @version v1 2019/12/10 下午7:17
 */
@Data
public class AdditionalOrders implements BaseEntity {

    @Override
    public String getUrl() {
        return "/api/order/appoint/exist";
    }

    @Override
    public String getBody() {
        return GetBodyUtil.toJsonStr(this);
    }

    public AdditionalOrders(OrderId orderId, TransporterId transporterId, ShopNo shopNo) {
        this.orderId = orderId;
        this.transporterId = transporterId;
        this.shopNo = shopNo;
    }

    @NotNull
    OrderId orderId;

    @NotNull
    TransporterId transporterId;

    @NotNull
    ShopNo shopNo;
}
